package app.server.project.main.service.bo.dbquery;

import app.server.project.main.service.dto.cms.QueryUserInfoReq;
import cn.hutool.core.bean.BeanUtil;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.Objects;

@Data
public class QueryUserInfoParam {


    private Long targetUserId;
    private boolean charge;
    private String adChannel;
    private int orderType;

    private LocalDateTime startTime;
    private LocalDateTime endTime;

    private Long inviteId;

    public static QueryUserInfoParam of(QueryUserInfoReq req) {
        var ret = new QueryUserInfoParam();
        BeanUtil.copyProperties(req, ret, true);
        if (Objects.nonNull(ret.getEndTime())) {
            ret.setEndTime(ret.getEndTime().plusDays(1));
        }
        return ret;
    }
}
